<template>
  <el-dropdown @command="changeLang">
    <span class="el-dropdown-link">
      <svg-icon icon-class="language"></svg-icon>
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="en" :disabled="$i18n.locale === 'en'">
        English
      </el-dropdown-item>
      <el-dropdown-item command="zh" :disabled="$i18n.locale === 'zh'">
        中文
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import Cookies from "js-cookie";
export default {
  methods: {
    changeLang(cmd) {
      this.$i18n.locale = cmd;
      Cookies.set("lang", cmd);
      this.$router.go(0);
    },
  },
};
</script>

<style>
</style>